﻿@{
    ViewBag.Title = ViewBag.DomainTitle + "数据中心";
    Layout = "~/Views/Shared/_Layout.cshtml";
    var menuList = (List<QunProject.Model.sys_menu>)ViewBag.MenuList;
    var loginUser = (QunProject.Model.sys_user)ViewBag.LoginUser;
    if (loginUser == null)
    {
        loginUser = new QunProject.Model.sys_user();
    }
    if (menuList == null)
    {
        menuList = new List<QunProject.Model.sys_menu>();
    }
}

<div class="layui-layout layui-layout-admin">
    <div class="layui-header">
        <div class="layui-logo">@ViewBag.DomainTitle Manager</div>
        <ul class="layui-nav layui-layout-left" id="iframe-item-container">
            <li class="layui-nav-item layui-this" data-funcid="homePage"><a href="javascript:void(0);" onclick="javascript: { iframe.open('homePage','','首页'); }">首页</a></li>
        </ul>
        <ul class="layui-nav layui-layout-right">
            <li class="layui-nav-item">
                <a href="javascript:void(0);">
                    <img src="~/Resources/img/admin.jpg" class="layui-nav-img" />
                    @loginUser.Name
                </a>
                <dl class="layui-nav-child">
                    <dd><a href="javascript:void(0)" onclick="javascript: { iframe.closeAll(); }">关闭所有</a></dd>
                    <dd><a href="javascript:void(0)" onclick="javascript: { iframe.open('updatePassword','/Home/Password','修改密码'); }">修改密码</a></dd>
                    <dd><a href="/Home/ClearCache">清除缓存</a></dd>
                    <dd><a href="/Home/LoginOut">退出登录</a></dd>
                </dl>
            </li>
        </ul>
    </div>
    <div class="layui-side layui-bg-black" id="system-menu">
        <div class="layui-side-scroll">
            <ul class="layui-nav layui-nav-tree" lay-filter="test">
                @{
                    foreach (var item in menuList.Where(x => x.Pid == 0))
                    {
                        if (item.Pid == 0 && !string.IsNullOrWhiteSpace(item.Url))
                        {
                            <li class="layui-nav-item"><a href="javascript:void(0);" onclick="javascript: { iframe.open('@item.ID','@item.Url','@item.Title'); }">@item.Title</a></li>
                        }
                        else
                        {
                            <li class="layui-nav-item layui-nav-itemed">
                                <a href="javascript:void(0);">@item.Title</a>
                                <dl class="layui-nav-child">
                                    @foreach (var child in menuList.Where(x => x.Pid == item.ID))
                                    {
                                        <dd><a href="javascript:void(0);" onclick="javascript: { iframe.open('@child.ID','@child.Url','@child.Title'); }">@child.Title</a></dd>
                                    }
                                </dl>
                            </li>
                        }
                    }
                }
            </ul>
        </div>
    </div>
    <div class="layui-body" id="iframe-container" style="overflow:hidden;">
        <iframe class="iframe-option" src="/Home/Page" data-funcid="homePage"></iframe>
    </div>
    <div class="layui-footer">
        © <a href="http://www.codertalking.com" target="_blank">www.codertalking.com</a> 版权所有 CoderTalking<a href="http://www.miitbeian.gov.cn" target="_blank" style="margin-left:30px;">渝ICP备18008742号-1</a>
    </div>
</div>

@Html.Partial("~/Views/Shared/_Script.cshtml")